package crazy.java;

import org.junit.Test;

/**
 * @author futao
 * Created on 2017/11/23 - 9:16.
 */
public class ArrayMine {
    @Test
    public void arr() {
        //定义一个整型数组
        int[] arr;
        //初始化 1
        arr = new int[]{0, 10};
        //2
        arr = new int[10];
        //二维数组
        int[][] arr2;
        arr2 = new int[10][10];
        arr2 = new int[][]{arr, arr};
        //遍历输出二维数组的值
        for (int[] i : arr2) {
            for (int j : i) {
                System.out.println(j);
            }
        }
        // 3
        String[] strArr = {"666", "777"};
        char[] chars = new char[5];
        for (char i : chars) {
            System.out.println("char=" + i);
        }
    }

    /**
     * 99乘法表 1分钟
     */
    @Test
    public void nineNine() {
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print(i + "*" + j + "=" + i * j);
                System.out.print("    ");
            }
            System.out.println();
        }
    }

    /**
     * 等腰三角形
     */
    @Test
    public void case001() {
        int line = 4;
        for (int i = 1; i <= line; i++) {
            for (int j = 1; j<=line-i; j--) {
                System.out.print(" ");
            }
            for (int k =1;k<=2*i-1;k++){
                System.out.println("*");
            }
        }
    }
}
